<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="org.springframework.web.context.WebApplicationContext"%>
<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@page import="db.UserDAO"%>
<%@page import="db.User"%>
<%@page import="db.GroupDAO"%>
<%@page import="db.Group"%>
<%@ include file="/jsp/common/utility/logined.jsp" %>
<%
	WebApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
	UserDAO userDao = (UserDAO)ctx.getBean("UserDAO");
	GroupDAO groupDao = (GroupDAO)ctx.getBean("GroupDAO");

	String uid_str = (String)request.getParameter("uid");
	
	Integer uid_int = Integer.parseInt(uid_str);
	User user = userDao.findById(uid_int);
	if(user != null){
		request.setAttribute("user",user);
		
		Group group = groupDao.findById(user.getGroupId());
		if(group != null){
			request.setAttribute("group",group);
		}
		
		pageContext.forward("/vm/erp_tpl/adminPer.vm");
		return;
	}else{
		pageContext.forward("/index.jsp");
		return;
	}
	
%>